import json

#序列化 类型 json --> bytes
def Serialization(data):
    jdata = json.dumps(data)  # 序列化为字符串
    bdata = jdata.encode('utf-8')
    return bdata

#反序列化 bytes --> json
def Deserialization(bdata):
    str = bdata.decode('utf-8')
    jdata = json.loads(str)
    return jdata

def JsonStr2dict(str):
    dict = json.loads(str)
    return dict

def Dict2str(dict):
    jdata = json.dumps(dict)  # 序列化为字符串
    return jdata